/*
 *  Copyright 2010 Andrew Kroh
 *
 *  Kroh-IO is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Kroh-IO is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package kroh.io;

/**
 * <p>
 * Part of the loadable device driver interface. CommDriver should not be used
 * by application-level programs.
 */
public interface CommDriver
{
    /**
     * initialize() will be called by the CommPortIdentifier's static
     * initializer. The responsibility of this method is: 
     * 1) Ensure that that the hardware is present. 
     * 2) Load any required native libraries. 
     * 3) Register the port names with the CommPortIdentifier.
     */
    public abstract void initialize();
    
    /**
     * getCommPort() will be called by CommPortIdentifier.open() portName is a
     * string that was registered earlier using the
     * CommPortIdentifier.addPortName() method. getCommPort() returns an object
     * that extends either SerialPort or ParallelPort.
     * 
     * @param portName
     * @param portType
     * @return
     */
    public abstract CommPort getCommPort(String portName, int portType);
}
